#!/usr/bin/python3
# coding=utf-8

# Copyright (c) 2025 Huawei Technologies Co., Ltd.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================

import os

import numpy as np


def gen_golden_data():
    if not os.path.exists("./input"):
        os.makedirs("./input")
    if not os.path.exists("./output"):
        os.makedirs("./output")

    m, n, k = 30720, 1024, 1024

    a_gm = np.random.uniform(1, 10, [m, k]).reshape([m, k]).astype(np.float32)
    b_gm = np.random.uniform(1, 10, [k, n]).reshape([k, n]).astype(np.float32)
    bias_gm = np.random.uniform(1, 10, [n]).reshape([n]).astype(np.float32)
    golden_c = np.matmul(a_gm, b_gm, dtype=np.float32) + bias_gm

    a_gm.tofile("./input/a_gm.bin")
    b_gm.tofile("./input/b_gm.bin")
    bias_gm.tofile("./input/bias_gm.bin")
    golden_c.tofile("./output/golden_c.bin")


if __name__ == "__main__":
    gen_golden_data()
